package com.解释器模式;

/**
 * @author Fang Ruichuan
 * @date 2022-12-22 20:13
 */

public class Client {
    public static void main(String[] args) {
        // 创建上下文对象进行解释
        CalculatorContext calculatorContext = new CalculatorContext("10 + 20");
        // 获取执行结果
        System.out.println("calculatorContext.calculate() = " + calculatorContext.calculate());

        CalculatorContext calculatorContext2 = new CalculatorContext("10 + 20 - 15");
        System.out.println("calculatorContext.calculate() = " + calculatorContext2.calculate());
    }
}
